{template 'common/header'}
		<link rel="stylesheet" href="../addons/ewei_shop/template/mobile/zbh/static/css/mui.dtpicker.css" />
		<link rel="stylesheet" href="../addons/ewei_shop/template/mobile/zbh/static/css/mui.picker.css" />
		<link rel="stylesheet" href="../addons/ewei_shop/template/mobile/zbh/static/css/mui.poppicker.css" />
<div id="container"></div>
<script id="member_info" type="text/html">
		<div class="mui-content content-bg-w7">
			<header class="mui-bar mui-bar-nav">
				<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left header-back-icon"></a>
				<h1 class="mui-title">会员资料</h1>
			</header>
			<div class="list-member-info-edit">
					<ul class="list-group-member-info">
						<li class="list-item-member-info">
							<div class="text-menmber-tittle">
								<span>姓</span>
								<span>名</span>
							</div>
							<div class="input-member-edit">
								<input id="realname" type="text" value="<%realname%>" placeholder="请输入您的姓名" />
							</div>
						</li>
						<li class="list-item-member-info">
							<div class="text-menmber-tittle">
								<span>手</span>
								<span>机</span>
								<span>号</span>
								<span>码</span>
							</div>
							<div class="input-member-edit">
								<input id="mobile" type="text" value="<%mobile%>" placeholder="请输入您的手机号码" />
							</div>
						</li>
						<li class="list-item-member-info">
							<div class="text-menmber-tittle">
								<span>微</span>
								<span>信</span>
								<span>号</span>
							</div>
							<div class="input-member-edit">
								<input id="weixin" type="text" value="<%weixin%>" placeholder="请输入您的微信号" />
							</div>
						</li>
						<li class="list-item-member-info">
							<div class="text-menmber-tittle">
								<span>性</span>
								<span>别</span>
							</div>
							<div class="input-member-edit">
								<div class="checkbox-member-edit">
									<input type="radio" name="sex_btn_man" id="sex_btn_man" value="1" <%if gender=='1'%>checked="checked"<%/if%> />
									<span class="chexk-btn-change <%if gender=='1'%>active<%/if%>"></span>
									<span class="text-checkbox">男</span>
								</div>
								<div class="checkbox-member-edit">
									<input type="radio" name="sex_btn_woman" id="sex_btn_woman" value="2" />
									<span class="chexk-btn-change <%if gender=='2'%>active<%/if%>"></span>
									<span class="text-checkbox">女</span>
								</div>
								<input type="hidden" id="gender" value="<%sex%>" />
							</div>
						</li>
						<li class="list-item-member-info">
							<div class="text-menmber-tittle">
								<span>所</span>
								<span>在</span>
								<span>城</span>
								<span>市</span>
							</div>
							<div class="input-member-edit">
								<input id="member_location_city" type="text" value="<%province%> <%city%> <%area%>" placeholder="请输入您所在的城市" />
							</div>
						</li>
						<li class="list-item-member-info">
							<div class="text-menmber-tittle">
								<span>生</span>
								<span>日</span>
							</div>
							<div class="input-member-edit">
								<input id="birthday" value="<%birthday%>" data-options='{"type":"date","beginYear":1950,"endYear":2016}' type="text" placeholder="请输入您的生日" />
							</div>
						</li>
					</ul>
					<button class="info_sub button-submit-member-info" type="submit">
						确认修改
					</button>
			</div>
		</div>
</script>
		<script src="../addons/ewei_shop/template/mobile/zbh/static/js/mui.picker.js"></script>
		<script src="../addons/ewei_shop/template/mobile/zbh/static/js/mui.dtpicker.js"></script>
		<script src="../addons/ewei_shop/template/mobile/zbh/static/js/mui.poppicker.js"></script>
		<script src="../addons/ewei_shop/template/mobile/zbh/static/js/city.data-3.js"></script>

<script type="text/javascript">
	require(['tpl', 'core'], function(tpl, core) {
		core.json('member/info',{},function(json){
			if (json.result.member) {
				var data = json.result.member;
				$('#container').html(tpl('member_info', data));
				(function($) {
					$.init();
					var result = $('#birthday')[0];
					document.getElementById('birthday').addEventListener('tap', function() {
						var optionsJson = this.getAttribute('data-options') || '{}';
						var options = JSON.parse(optionsJson);
						var picker = new $.DtPicker(options);
						picker.show(function(rs) {
							result.value = rs.text;
							picker.dispose();
						});
					}, false);
				})(mui);
				(function($, doc) {
					$.init();
					$.ready(function() {
						//普通示例

						//-----------------------------------------
						//					//级联示例
						var cityPicker3 = new $.PopPicker({
							layer: 3
						});
						cityPicker3.setData(cityData3);
						var showCityPickerButton = doc.getElementById('member_location_city');
						showCityPickerButton.addEventListener('tap', function(event) {
							cityPicker3.show(function(items) {
								showCityPickerButton.value = (items[0] || {}).text + " " + (items[1] || {}).text + " " + (items[2] || {}).text;
								//返回 false 可以阻止选择框的关闭
								//return false;
							});
						}, false);
					});
				})(mui, document);
				$('.checkbox-member-edit').click(function() {
					$(this).find('input').attr("checked", 'checked')
					$(this).find('.chexk-btn-change').addClass('active');
					$(this).siblings().find('.chexk-btn-change').removeClass('active')
					$(this).siblings().find('input').attr("checked", false)
					var val = $(this).find('input').val();
					$('#gender').val(val);
				})
				$('.info_sub').click(function() {
					if($(this).attr('saving')=='1')
					{
						return;
					}

					if( $('#realname').isEmpty()){
						mui.toast('请输入姓名!');
						return;
					}
					if(!$('#mobile').isMobile()){
						mui.toast('请输入正确手机号码!');
						return;
					}
					if( $('#weixin').isEmpty()){
						mui.toast('请输入微信号!');
						return;
					}

					$(this).html('正在处理...').attr('saving',1);
					var birthday = $('#birthday').val().split('-');
					var member_location_city = $('#member_location_city').val().split(' ');
					core.json('member/info', {
						'memberdata':{
							'realname': $('#realname').val(),
							'mobile': $('#mobile').val(),
							'weixin': $('#weixin').val(),
							'gender': $('#gender').val(),
							'birthyear': $('#birthday').val().length>0?birthday[0]:0,
							'birthmonth': $('#birthday').val().length>0?birthday[1]:0,
							'birthday': $('#birthday').val().length>0?birthday[2]:0,
							'province': $('#member_location_city').val().length>0?member_location_city[0]:0,
							'city': $('#member_location_city').val().length>0?member_location_city[1]:0,
							'area': $('#member_location_city').val().length>0?member_location_city[2]:0
						}, 'mcdata':{
							'realname': $('#realname').val(),
							'mobile': $('#mobile').val(),
							'gender': $('#gender').val(),
							'birthyear': $('#birthday').val().length>0?birthday[0]:0,
							'birthmonth': $('#birthday').val().length>0?birthday[1]:0,
							'birthday': $('#birthday').val().length>0?birthday[2]:0,
							'resideprovince': $('#member_location_city').val().length>0?member_location_city[0]:0,
							'residecity': $('#member_location_city').val().length>0?member_location_city[1]:0,
							'residedist': $('#member_location_city').val().length>0?member_location_city[2]:0
						}
					}, function(json) {
						if(json.status==1){
							mui.toast('保存成功');
							{if !empty($_GPC['returnurl'])}
							location.href="{php echo urldecode($_GPC['returnurl'])}";
							{else}
							location.href="{php echo $this->createMobileUrl('member')}";
							{/if}
						} else{
							$('.info_sub').html('确认修改').removeAttr('saving');
							mui.toast('保存失败!');
						}

					},true,true);
				})
			}
		});
	})
</script>
{template 'common/footer'}